//#include "xmlparse.h"
//#include "Parser.h"
//#include "ViewXML.h"
#include "DequePersistent.h"
#include "FactoryPersistent.h"
#include "SampleSourcesafe.h"
#include "../../consult/fuentes/SursafeDAO.h"
int main()
{
	DequePersistent cola;
	SampleSourcesafe * samSurface;
	int ind,cantMuestras;
	cola.setAtributte("date");
//	//muestra 1
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("230");
		samSurface->setAltm("1019.0");
		samSurface->setDate("2007-10-10");
		samSurface->setDew("11");
		samSurface->setDir("180");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("62");
		samSurface->setSpd("12");
		samSurface->setTmp("18");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
			
		cola.insertSort(samSurface);
	
		//muestra 2
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("231");
		samSurface->setAltm("999.0");
		samSurface->setDate("2007-10-11");
		samSurface->setDew("15");
		samSurface->setDir("180");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("62");
		samSurface->setSpd("12");
		samSurface->setTmp("15");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
				
		cola.insertSort(samSurface);
		
		//muestra 3
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("232");
		samSurface->setAltm("1019.0");
		samSurface->setDate("2007-10-12");
		samSurface->setDew("11");
		samSurface->setDir("180");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("62");
		samSurface->setSpd("12");
		samSurface->setTmp("17");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
					
		cola.insertSort(samSurface);
		
		//muestra 4
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("233");
		samSurface->setAltm("1019.0");
		samSurface->setDate("2007-10-09");
		samSurface->setDew("15");
		samSurface->setDir("360");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("42");
		samSurface->setSpd("12");
		samSurface->setTmp("25");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
					
		cola.insertSort(samSurface);
		
		//muestra 5
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("234");
		samSurface->setAltm("1001.0");
		samSurface->setDate("2007-10-06");
		samSurface->setDew("11");
		samSurface->setDir("140");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("62");
		samSurface->setSpd("12");
		samSurface->setTmp("18");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
					
		cola.insertSort(samSurface);
		
		//muestra 6
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SARC");
		samSurface->setPKSampleSourcesafe("235");
		samSurface->setAltm("1015.0");
		samSurface->setDate("2007-10-07");
		samSurface->setDew("11");
		samSurface->setDir("80");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("62");
		samSurface->setSpd("12");
		samSurface->setTmp("20");
		samSurface->setVis("10.0");
		samSurface->setWeather("R-");
					
		cola.insertSort(samSurface);
		
		//muestra 7
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("236");
		samSurface->setAltm("1000.0");
		samSurface->setDate("2007-10-01");
		samSurface->setDew("15");
		samSurface->setDir("10");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("82");
		samSurface->setSpd("12");
		samSurface->setTmp("26");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
					
		cola.insertSort(samSurface);
		
		//muestra 8
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("237");
		samSurface->setAltm("1000.0");
		samSurface->setDate("2007-10-02");
		samSurface->setDew("26");
		samSurface->setDir("40");
		samSurface->setGus("");
		samSurface->setHour("12:00");
		samSurface->setRh("99");
		samSurface->setSpd("12");
		samSurface->setTmp("27");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
				
		cola.insertSort(samSurface);
		
		//muestra 9
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("238");
		samSurface->setAltm("1019.0");
		samSurface->setDate("2007-10-03");
		samSurface->setDew("8");
		samSurface->setDir("240");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("52");
		samSurface->setSpd("12");
		samSurface->setTmp("15");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
					
		cola.insertSort(samSurface);
		
		//muestra 10
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("239");
		samSurface->setAltm("1015.0");
		samSurface->setDate("2007-10-05");
		samSurface->setDew("11");
		samSurface->setDir("270");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("62");
		samSurface->setSpd("12");
		samSurface->setTmp("20");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
					
		cola.insertSort(samSurface);
		
		//muestra 11
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SARP");
		samSurface->setPKSampleSourcesafe("240");
		samSurface->setAltm("1010.0");
		samSurface->setDate("2007-10-04");
		samSurface->setDew("18");
		samSurface->setDir("240");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("78");
		samSurface->setSpd("12");
		samSurface->setTmp("22");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
					
		cola.insertSort(samSurface);
		
		//muestra 12
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("241");
		samSurface->setAltm("1000.0");
		samSurface->setDate("2007-10-08");
		samSurface->setDew("24");
		samSurface->setDir("0");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("98");
		samSurface->setSpd("12");
		samSurface->setTmp("26");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
					
		cola.insertSort(samSurface);
		
		//muestra 13
		samSurface = (SampleSourcesafe *)FactoryPersistent::getObjectFromTable("sampleSourcesafe");
		samSurface->setStationCode("SABE");
		samSurface->setPKSampleSourcesafe("242");
		samSurface->setAltm("1009.0");
		samSurface->setDate("2007-10-13");
		samSurface->setDew("17");
		samSurface->setDir("270");
		samSurface->setGus("14");
		samSurface->setHour("12:00");
		samSurface->setRh("70");
		samSurface->setSpd("12");
		samSurface->setTmp("21");
		samSurface->setVis("8.0");
		samSurface->setWeather("R-");
					
		cola.insertSort(samSurface);
		cantMuestras = cola.getSize();
		std::cout<<"Tamano de la cola "<<cantMuestras<<std::endl;
		for (ind=0;ind<cantMuestras;++ind)
		{
			
			std::cout<<"Date "<<ind<<" Fecha: "<<(((SampleSourcesafe *)cola.getPersistent(ind))->getDate());
			std::cout<<"\n";
		}
		std::cout<<"Test: Eliminar 1ero\n";
		cola.popFront();
		cantMuestras = cola.getSize();
		std::cout<<"Tamano de la cola "<<cantMuestras<<std::endl;
		for (ind=0;ind<cantMuestras;++ind)
		{
			std::cout<<"Date "<<ind<<" Fecha: "<<((SampleSourcesafe *)cola.getPersistent(ind))->getDate();
			std::cout<<"\n";
		}
		std::cout<<"Test: Eliminar 1ero\n";
		cola.popFront();
		cantMuestras = cola.getSize();
		std::cout<<"Tamano de la cola "<<cantMuestras<<std::endl;
		for (ind=0;ind<cantMuestras;++ind)
		{
			std::cout<<"Date "<<ind<<" Fecha: "<<((SampleSourcesafe *)cola.getPersistent(ind))->getDate();
			std::cout<<"\n";
		}
		std::cout<<"Test: Eliminar 1ero\n";
		cola.popFront();
		cantMuestras = cola.getSize();
		std::cout<<"Tamano de la cola "<<cantMuestras<<std::endl;
		for (ind=0;ind<cantMuestras;++ind)
		{
			std::cout<<"Date "<<ind<<" Fecha: "<<((SampleSourcesafe *)cola.getPersistent(ind))->getDate();
			std::cout<<"\n";
		}
		std::cout<<"Test: Eliminar ultimo\n";
		cola.popBack();
		cantMuestras = cola.getSize();
		std::cout<<"Tamano de la cola "<<cantMuestras<<std::endl;
		for (ind=0;ind<cantMuestras;++ind)
		{
			std::cout<<"Date "<<ind<<" Fecha: "<<((SampleSourcesafe *)cola.getPersistent(ind))->getDate();
			std::cout<<"\n";
		}
		std::cout<<"Test: Eliminar ultimo\n";
		cola.popBack();
		cantMuestras = cola.getSize();
		std::cout<<"Tamano de la cola "<<cantMuestras<<std::endl;
		for (ind=0;ind<cantMuestras;++ind)
		{
			std::cout<<"Date "<<ind<<" Fecha: "<<((SampleSourcesafe *)cola.getPersistent(ind))->getDate();
			std::cout<<"\n";
		}
		std::cout<<"Test: Eliminar ultimo\n";
		cola.popBack();
		cantMuestras = cola.getSize();
		std::cout<<"Tamano de la cola "<<cantMuestras<<std::endl;
		for (ind=0;ind<cantMuestras;++ind)
		{
			std::cout<<"Date "<<ind<<" Fecha: "<<((SampleSourcesafe *)cola.getPersistent(ind))->getDate();
			std::cout<<"\n";
		}
		cola.sort("PKSampleSourcesafe");
		cantMuestras = cola.getSize();
		for (ind=0;ind<cantMuestras;++ind)
		{
			std::cout<<"PKSampleSourcesafe "<<ind<<" "<<((SampleSourcesafe *)cola.getPersistent(ind))->getPKSampleSourcesafe();
			std::cout<<"\n";
		}
		cola.clear();
 return 0;	
}
//
//int main()
//{
//	ViewXML *doc = new ViewXML();
//	
//	XMLNode *node = new XMLNode();
//	
//	node->agregarHijo(new XMLNode());
//	
//	node->agregarHijo(new XMLNode());
//	
//	node->agregarHijo(new XMLNode());
//	
//	node->agregarHijo(new XMLNode());
//	
//	node->agregarHijo(new XMLNode());
//	
//	doc->agregarHijo(node);
//	
//	delete doc;
//	
//	return 0;
//}

